/* Copyright (c) 2021, National University of Defense Technology. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *     http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef PARBSR_BLOCKJACOBISOR_PRECONDITIONER_H
#define PARBSR_BLOCKJACOBISOR_PRECONDITIONER_H

#include "parbsr_preconditioner.h"

namespace YHAMG
{

class ParBSR_BlockJacobiSOR_Preconditioner : public ParBSR_Preconditioner
{
private:
	int num_threads;
	double* D;
	double* D_LU;
	BSR_Matrix L;
	BSR_Matrix U;

public:
	int Type;
	double Factor;

	ParBSR_BlockJacobiSOR_Preconditioner();
	ParBSR_BlockJacobiSOR_Preconditioner(int type, double factor);
	~ParBSR_BlockJacobiSOR_Preconditioner();

	void Free();
	void Setup(const ParBSR_Matrix& A, int REUSE = 0);
	int InSize() const;
	int OutSize() const;
	void Apply(const Par_Vector& b, const Par_Vector& x) const;
};

}

#endif